// 云函数入口文件
const cloud = require('wx-server-sdk')
var rp = require('request-promise');
// cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境
const province = require('./province/index');
const banner = require('./banner/index');
const place = require('./place/index');
const share = require('./share/index');
const search = require('./search/index');
// 云函数入口函数
// exports.main = async (event, context) => {
//     const wxContext = cloud.getWXContext()

//     return {
//         event,
//         openid: wxContext.OPENID,
//         appid: wxContext.APPID,
//         unionid: wxContext.UNIONID,
//     }
// }
exports.main = async (event, context) => {
    switch (event.type) {
        case 'province':
            return await province.main(event, context);
        case 'banner':
            return await banner.main(event, context);
        case 'place':
            return await place.main(event, context);
        case 'share':
            return await share.main(event, context);
        case 'search':
            return await search.main(event, context);

    }
};
// const db = cloud.database()
// // 注意这里的 album 正是在数据库中新增的集合
// exports.main = async (event, context) => {
// 	 return db.collection("my_province").get()
// }


